#include "StrategyGen.h"
using namespace BWAPI;
using namespace std;

StrategyGen::StrategyGen(void)
{
}

StrategyGen::StrategyGen(map<string, vector<string>*> &rhs)
{
	setStrategy(rhs);
}
StrategyGen::~StrategyGen(void)
{
		for(map<string, vector<string>*>::iterator it = strategy.begin();
			it != strategy.end(); it++)
				delete[] (*it).second;
}
StrategyGen &StrategyGen::operator=(const StrategyGen &rhs)
{
	strategy = rhs.strategy;
	return *this;
}
void StrategyGen::setTargetsSpecial()
{
}

void StrategyGen::setStrategy(map<string, vector<string>*> &rhs)
{
	for(map<string, vector<string>*>::iterator it = strategy.begin();
		it != strategy.end(); it++)
		strategy.erase(it);
	for(map<string, vector<string>*>::iterator it = rhs.begin();
		it != rhs.end(); it++)
	{
		vector<string> *vec = new vector<string>;
		vec = (*it).second;
		strategy[(*it).first] = vec;
	}
}

vector<string> & StrategyGen::getTargetPriority(string name)
{
		map<string, vector<string>*>::iterator it =	strategy.find(name);
	if(name == "")
	{
		
		return targets;
	}
	else if((it) != strategy.end())
	{
		vector<string> *target = (*it).second;
		return *target;
	}
	
	return targets;
}